﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace QMERP.Infrastructure.EFCore.Migrations
{
    /// <inheritdoc />
    public partial class init34 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<string>(
                name: "Description",
                table: "Lens",
                type: "nvarchar(400)",
                maxLength: 400,
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "Diameter",
                table: "BulkOrderDetail",
                type: "int",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Packet",
                table: "BulkOrderDetail",
                type: "nvarchar(500)",
                maxLength: 500,
                nullable: true);

            migrationBuilder.AddColumn<long>(
                name: "SupplierId",
                table: "BulkOrderDetail",
                type: "bigint",
                nullable: false,
                defaultValue: 0L);

            migrationBuilder.AddColumn<string>(
                name: "OrderRef",
                table: "BulkOrder",
                type: "nvarchar(50)",
                maxLength: 50,
                nullable: false,
                defaultValue: "");

            migrationBuilder.CreateIndex(
                name: "IX_BulkOrderDetail_SupplierId",
                table: "BulkOrderDetail",
                column: "SupplierId");

            migrationBuilder.AddForeignKey(
                name: "FK_BulkOrderDetail_Supplier_SupplierId",
                table: "BulkOrderDetail",
                column: "SupplierId",
                principalTable: "Supplier",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_BulkOrderDetail_Supplier_SupplierId",
                table: "BulkOrderDetail");

            migrationBuilder.DropIndex(
                name: "IX_BulkOrderDetail_SupplierId",
                table: "BulkOrderDetail");

            migrationBuilder.DropColumn(
                name: "Description",
                table: "Lens");

            migrationBuilder.DropColumn(
                name: "Diameter",
                table: "BulkOrderDetail");

            migrationBuilder.DropColumn(
                name: "Packet",
                table: "BulkOrderDetail");

            migrationBuilder.DropColumn(
                name: "SupplierId",
                table: "BulkOrderDetail");

            migrationBuilder.DropColumn(
                name: "OrderRef",
                table: "BulkOrder");
        }
    }
}
